#include<iostream>
#include<boost/coroutine2/coroutine.hpp>

using namespace boost::coroutines2;

void coro_function(coroutine<int>::push_type& sink) {
    for (int i = 0; i < 5; ++i)
    {
        std::cout << "Coroutine: " << i << std::endl;
        sink(i);
    }
}

int main() {
    coroutine<int>::pull_type source(coro_function);

    while (source)
    {
        std::cout << "Main: " << source.get() << std::endl;
        source();
    }

    return 0;
}